// useFetch.js
import { useState, useRef, useEffect } from "react";

function useFetch(pros: any) {
  const [data, setData] = useState(null);
  const [loading, setLoading] = useState(true);
  const [error, setError] = useState(null);

  // console.log("pros", pros);

  const propsValue = useRef(null);

  useEffect(() => {
    console.log("propsValue.current", propsValue.current);

    propsValue.current = pros;
    setData(JSON.stringify(propsValue.current));
    console.log("propsValue.current222", propsValue.current);
  }, [pros]);

  return { data, loading, error };
}
export default useFetch;
